//
//  DeviceItemCollectionViewCell.m
//  LightControl
//
//  Created by CKF on 2025/8/11.
//

#import "DeviceItemCollectionViewCell.h"

@implementation DeviceItemCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth*0.5-30, 130)];
        bgView.backgroundColor = [UIColor whiteColor];
        bgView.layer.shadowOpacity = 0.5;          // 阴影透明度（0~1）
        bgView.layer.shadowColor = [UIColor grayColor].CGColor; // 阴影颜色
        bgView.layer.shadowRadius = 3;             // 阴影扩散范围（值越大越模糊）
        bgView.layer.shadowOffset = CGSizeMake(0, 3); // 阴影偏移（0,0表示四周均匀）
        bgView.layer.masksToBounds = NO;
        bgView.layer.cornerRadius = 10;
        bgView.clipsToBounds = NO;
        [self.contentView addSubview:bgView];
        
        
        _imgView = [[UIImageView alloc]initWithFrame:CGRectMake(KScreenWidth*0.25-35, 12, 40, 40)];
        [bgView addSubview:_imgView];
    
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(15,CGRectGetMaxY(_imgView.frame)+15, KScreenWidth*0.5-60, 20)];
        [bgView addSubview:_titleLabel];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        _titleLabel.textColor = RGB(51, 51, 51);
        
        _detailLabel =  [[UILabel alloc]initWithFrame:CGRectMake(15, CGRectGetMaxY(_titleLabel.frame)+5, KScreenWidth*0.5-60, 17)];
        [bgView addSubview:_detailLabel];
        _detailLabel.font = [UIFont systemFontOfSize:13];
        _detailLabel.textColor = RGB(102, 102, 102);
        
    }
    return self;
}

@end
